package com.eshang.test.swagger.controller;

import com.eshang.test.base.entity.Student;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("controller")
public class StudentController {
	Student student = new Student();

	@ApiOperation("返回固定的student")      //给方法加上注释
	@GetMapping("testSwaggerWithStudent")
	public Student testSwaggerWithStudent(){
		student.setStuName("张三");
		student.setStuNo(1);
		student.setStuSex(true);
		return student;
	}

	@ApiOperation("返回输入的student")      //给方法加上注释
	@PostMapping("testSwaggerWithStudentParameter")
	public Student testSwaggerWithStudentParameter(@ApiParam("从前端传入的学生类")Student student){
		return student;
	}

}
